package com.itqf.controller;

import com.itqf.annotation.RequiresPermissionsDesc;
import com.itqf.service.DtsUserService;
import com.itqf.util.ResponseUtil;
import com.itqf.vo.StatVo;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * projectName: shop_manage
 *
 * @author: MaTianWei
 * time: 2021/7/17 9:14
 * description:用户统计
 */
@RestController
@CrossOrigin("*")
@RequestMapping("/admin/stat")
public class AdminUserStatController {
    @Autowired
    private DtsUserService dtsUserService;

    public static final Logger logger = LoggerFactory.getLogger(AdminUserStatController.class);
    @RequiresPermissions("admin:stat:user")
    @RequiresPermissionsDesc(menu = {"用户统计","用户"},button = "用户统计展示")
    @GetMapping("user")
    public Object user(){
        Map data = new HashMap();
        String [] columns ={"day","users"};
        List<Map> rows =dtsUserService.querRows();
        data.put("columns",columns);
        data.put("rows",rows);
        return ResponseUtil.ok(data);

    }
}
